package com.encryption.controls.util
{
	import flash.events.Event;
	import flash.events.IEventDispatcher;
	import flash.net.FileReference;
	import flash.net.URLRequest;
	
	import mx.controls.Alert;
	
	public class FileDownLoad
	{
		private var downloadURL:URLRequest;
		private var downLoadfile:FileReference; //这是要主要的地方
		
		public function FileDownLoad()
		{
		}
		
		//http://XX.XX.XX.XX:8080/upload/main.zip
		public function downLoadFiles(urlAdd:String):void
		{
			downloadURL = new URLRequest(urlAdd);
			downLoadfile = new FileReference();
			configureListeners(downLoadfile);
			downLoadfile.download(downloadURL);
		}
		private function configureListeners(dispatcher:IEventDispatcher):void {
			dispatcher.addEventListener(Event.COMPLETE, completeHandler);
		}
		
		private function completeHandler(event:Event):void {
			Alert.show("文件下载成功");
		}
	}
}